<?php
// 本类由系统自动生成，仅供测试用途
namespace Home\Controller;
use Think\Controller;
class PublicController extends Controller {
    public function view($view){

		//导航栏选	
		$class=get_class($this);		
		$meun=strtolower(substr(basename($class),0,-10));		
		$this->assign('meun',$meun);
		
		$this->display('layout:header');
		$this->display();
		$this->display('layout:footer');
	
    }
	
	
	//读取分类树
	public function gettree($pid,$retul=array()){
		$Model=D('Category');
		$list=$Model->where(' parentid='.$pid)->select();
		foreach($list as $key=>$val){
			$retul[$val['catid']]=$val;	
			if(empty($retul[$val['catid']]['chile'])){
				$retul[$val['catid']]['chile']=array();	
				}
			$retul[$val['catid']]['chile']=$this->gettree($val['catid'],$retul[$val['catid']]['chile']);
		}
		 return $retul;
	}
	
	
	//
	public function getparams(){
		
		$params_params=session('params');
		
		$params_params=empty($params_params)?array():$params_params;
		
		if(!empty($_GET)){
			$params=array_merge($params_params,$_GET);
			session("params",$params);	
		}
		$params=session('params');
		
		return $params;

	}
	
	
	
	//读取不同类型的商品列表
	public function getshoplist($type='new',$count=10){
		
		$Model=D('Goods');
		
		$list=$Model->where(" $type=1 ")->limit($count)->order(' id desc ')->select();
		
		return $list; 
		
	}
	
	

}